// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'


//引入vuex 并且把vuex注册为Vue的插件
import Vuex from "vuex";
Vue.use(Vuex)
//创建仓库 并 注册
const store = new Vuex.Store({
    //使用vuex的严格模式
    strict: true,
    //store的所有配置项都会转绑给store
    //数据
    state:{
      count:1000
    },
    //操作数据的工具
    mutations:{
      //所有的mutation函数接受的一个参数就是state
      add(state,{payload,payload2}){
        console.log(payload,payload2);
        state.count++;
        Vue.set(state,"name","damu")
      },
      des(state){
        state.count--
      }
    }
})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  components: { App },
  template: '<App/>',
  store //注册仓库
})
